package com.cqc.crm.service.impl;


import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.cqc.crm.dao.UserDao;
import com.cqc.crm.domain.User;
import com.cqc.crm.service.UserService;
import com.cqc.crm.utils.MD5Utils;
@Transactional
public class UserServiceImpl implements UserService {

	private UserDao userDao;
	public void setUserDao(UserDao userDao) {
		this.userDao = userDao;
	}


	@Override
	public List<User> findUserByUserName(String userName) {
		return userDao.findUserByUserName(userName);
	}
	@Override
	public void save(User user) {
		String md5Pwd= MD5Utils.md5(user.getUser_password());
		user.setUser_password(md5Pwd);
		user.setUser_state("1");
		userDao.save(user);
	}
	@Override
	public List<User> login(User user) {
		String md5Pwd= MD5Utils.md5(user.getUser_password());
		user.setUser_password(md5Pwd);
		return userDao.login(user);
	}

}
